<?php
//开启session




  $id = !empty($_GET['id'])?$_GET['id']:'';

       
if(!empty($_POST)){

  $_POST['power'] = implode(',', $_POST['power']);
   
   $_rows = edit('role',$id,$_POST);
   // echo $_rows;die;

               
                 
  // $_rows = edit('news',$id,$_POST); 

  if ($_rows>0) {
      echo '<script> alert ("角色编辑成功");location.href="index.php?c=role&a=list&admin=1";</script>';die;
         
  }else{

      echo '<script> alert ("角色编辑失败");history.go(-1);</script>';
          die;
  }


}



        $data = getSelectByOne('role',"id=$id");

        $data['power'] = explode(',', $data['power']);

      // print_r($data);die;

        $parent = getSelect('power','pid=0');
        $child = getSelect('power','pid!=0');





//链接语句
include (VIEW_PATH.$admin.'layout.html');

?>

